package org.lanqiao.service.impl;

import org.lanqiao.dao.IStudentDao;
import org.lanqiao.dao.impl.StudentDaoImpl;
import org.lanqiao.entity.Student;
import org.lanqiao.service.IStudentService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.sql.SQLException;

public class StudentServiceImpl implements IStudentService {

    IStudentDao studentDao;


    public void setStudentDao(IStudentDao studentDao) {
        this.studentDao = studentDao;
    }

    @Transactional(readOnly = false,propagation = Propagation.REQUIRED,rollbackFor = {SQLException.class,ArithmeticException.class })
    @Override
    public void addStudent(Student student) {

        //如果该学生是否存在
        //增加其他...
        studentDao.addStudent(student);
        System.out.println("进行增加操作");


    }

    @Override
    public void deleteStudentByNo(int stuNo) {
        System.out.println("模似删除...");
    }
}
